<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="/tld/dictionary" prefix="dictionary"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link rel="stylesheet" href="${ctx}/static/css/style.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/style1.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/kongjian.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/jquery.ui.all.css" />
<script src="${ctx}/static/script/jquery-1.4.min.js" type="text/javascript"></script>
<script src="${ctx}/static/script/jquery.ui.core.js"></script>
<script type="text/javascript" src="${ctx}/static/My97DatePicker/WdatePicker.js"></script>
<title>可交易债权</title>
</head>

<body>
<form:form id="mainForm" action="${ctx}/loansc/loans_trade" modelAttribute="loanForm" method="post" onSubmit="doSubmit();return false;">
<input type="hidden" name="pageNo" id="pageNo" value="${page.pageNo}"/>
<div class="er_banner">可交易债权</div>
		
   <div class="shenqing2">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="81">债权编号：</td>
            <td width="140px" style="color:#2E74D1;"><input type="text" id="loanId" name="loanId" class="ggkj_inputtext_80" value="${loanForm.loanId}"  /></td>
             <td width="81">投资编号：</td>
            <td width="140px" style="color:#2E74D1;"><input type="text" id="investId" name="investId" class="ggkj_inputtext_80" value="${loanForm.investId}"  /></td>
            <td width="85">债务人：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" id="loanCustomerName" name="loanCustomerName" value="${loanForm.loanCustomerName}"  class="ggkj_inputtext_80"  />
            </td>
			<td width="85">收益率：</td>
            <td width="250px" style="color:#2E74D1;">
            <input type="text" id="irrMin" name="irrMin" value="${loanForm.irrMin}"  class="ggkj_inputtext_80" value="10%" />-
            <input type="text" id="irrMax" name="irrMax" value="${loanForm.irrMax}"  class="ggkj_inputtext_80" value="10%" />
            </td>
			<td width="85">借款产品：</td>
			<td width="150px" style="color:#2E74D1;">
				 <select id="productCode"  name="productCode">
		             <option value="" selected="true">请选择</option>
		             <option value="1001" <c:if test="${loanForm.productCode=='1001'}">selected="true" </c:if> >随房贷</option>
			         <option value="1002" <c:if test="${loanForm.productCode=='1002'}">selected="true" </c:if>>随意贷</option>
			         <option value="1003" <c:if test="${loanForm.productCode=='1003'}">selected="true" </c:if>>随薪贷</option>
			         <option value="1004" <c:if test="${loanForm.productCode=='1004'}">selected="true" </c:if>>随车贷</option>
			         <option value="1005" <c:if test="${loanForm.productCode=='1005'}">selected="true" </c:if>>其他</option>   	
				</select>
			</td>
            </td>
			 <td width="93"><input name="Input" type="submit" class="chaxun_btn" value="&nbsp;&nbsp;查询" />
             </td>
          </tr>
      </table>
    </div>
<div class="yiban">
	<table style="width:100%;" class="ggkj_table"  border="0" cellspacing="0" cellpadding="0">
	<!--
	总交易额：${countAmt} 
	-->
  <tr>
    <th scope="col">序号</th>
    <th scope="col">债权编号</th>
    <th scope="col">投资编号</th>
    <th scope="col">债务人</th>
    <th scope="col">可交易金额</th>
    <th scope="col">可交易比</th>
    <th scope="col">还款期数</th>
    <th scope="col">剩余期数</th>
    <th scope="col">债权终止日期</th>
    <th scope="col">还款日</th>
    <th scope="col">Irr</th>
    <th scope="col">借款产品</th>
  </tr>
<c:forEach items="${page.result}" var="item" varStatus="stauts">
<fmt:formatNumber value="${item.loanInfo.pv*item.tradableScale}" pattern="##,###.##" var="pv_amt"/>
<fmt:formatNumber value="${item.tradableScale}" pattern="#0.000#" var="scale"/>
<c:if test="${pv_amt!='0'&& pv_amt!='-0'&& scale!='0.000'&& scale!='-0.000'}">
		<c:choose>
  			<c:when test="${stauts.count%2==0}">
  				<tr class="ggkj_tdColr">
  			</c:when>
  			<c:otherwise>
  				<tr >
  			</c:otherwise>
		</c:choose>
		<td>${stauts.count+(page.pageNo-1)*10}</td>
		<td>${item.loanId}</td>
		<td>${item.investInfo.id}</td>
		<td>${item.loanName}</td>
		<td>${pv_amt}</td>
		<td>${scale}</td>
		<td>${item.loanInfo.totalNum}</td>
		<td>${item.loanInfo.totalNum - item.loanInfo.currNum}</td>
		<td>${item.loanInfo.loanOverDate}</td>
		<td><dictionary:display code="${item.investInfo.loanReturnDate}"/></td>
		<td><fmt:formatNumber value="${item.irr}" pattern="#0.000#"/></td>
		<td>
		 <c:if test="${item.loanCode=='1001'}">
			    	随房贷
		</c:if>
		<c:if test="${item.loanCode=='1002'}">
			    	随意贷
		</c:if>
		<c:if test="${item.loanCode=='1003'}">
			    	随薪贷
		</c:if>
		<c:if test="${item.loanCode=='1004'}">
			    	随车贷
		</c:if>
		<c:if test="${item.loanCode=='1005'}">
			    	其他
		</c:if>
		</td>
		</tr>
	</c:if>
</c:forEach>
</table>
	
</div>
<div class="ggkj_pagecontainer">
  <div class="ggkj_pageBGleft">
    	<span class="ggkj_pageBGright"></span>
    	<a href="javascript:jumpPage(1)" class="ggkj_pageUpa">
        
        </a>
        <a href="javascript:jumpPage(${page.prePage})" class="ggkj_pageUp">
        
        </a>
        <span class="ggkj_insertline"></span>
        <span class="ggkj_pageSpan">
        	<input type="text" id="pageNo" name="pageNo" class="ggkj_inputtext_30" value="${page.pageNo}">OF ${page.totalPages}
        </span>
        <span class="ggkj_insertline"></span>
        <a href="javascript:jumpPage(${page.nextPage})" class="ggkj_pageDown">
        
        </a>
        <a href="javascript:jumpPage(${page.totalPages})" class="ggkj_pageDowna">
        
        </a>
        <span class="ggkj_insertline"></span>
        
    </div>
</div>
</form:form>
</body>
<script language="JavaScript">
	function jumpPage(pageNo) {
		document.getElementById('pageNo').value=pageNo;
		document.getElementById('mainForm').submit();
	}
	function doSubmit(){
	var patrn=/[0-9]+[.[0-9]+]?/;
	var irrMin=document.getElementById("irrMin");
	var irrMax=document.getElementById("irrMax");
	if(irrMin.value!=""){
		if (!patrn.test(irrMin.value)) {
			alert("收益率必须是正小数！");
			return ;
		}
	} 
	if(irrMax.value!=""){
		if (!patrn.test(irrMax.value)) {
			alert("收益率必须是正小数！");
			return ;
		}
	} 
		$("#pageNo").val(1);
		document.getElementById('mainForm').submit();
	}
</script>
</html>
